<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            height: 100px;
            width: 100px;
            background-color: yellowgreen;
            position: absolute;
        }
    </style>
</head>

<body style="margin: 0px;">
    <div class="box"></div>
</body>
<script>
    var box = document.querySelector('.box');
    // 匀速动画
    var a1 = setInterval(function() {
        box.style.left = (box.offsetLeft + 10) + 'px';
        console.log('left:' + box.style.left);
        if (box.offsetLeft == 200) {
            clearInterval(a1);
        }
    }, 30)
</script>

</html>